package com.xinchuang.service.impl;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xinchuang.comment.R;
import com.xinchuang.service.ThreeService;
import com.xinchuang.utils.CheckUtil;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.text.SimpleDateFormat;

import com.xinchuang.utils.DateUtils;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSON;

@Service
public class ThreeServiceImpl implements ThreeService {

    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @Override
    public String modleList(JSONObject jsonObject) {
        //jsonobject解析获取类型
        String type = jsonObject.getString("type");
        if (
                "0".equals(type)
        ) {
            return "{\"msg\":\"操作成功\",\"code\":200,\"data\":[{\"modelName\":\"飞机\",\"modelId\":\"xxxxx\",\"thuUrl\":\"地址\"}],\"success\":true}";
        }
        if (jsonObject == null || jsonObject.size() < 1
        ) {
            return "";
        }
        return JSON.toJSONString(R.success("无数据"));
    }

    @Override
    public String model(JSONObject jsonObject) {
        //jsonobject解析获取模型标识
        String modelId = jsonObject.getString("modelId");
        if (
                "xxxx".equals(modelId)
        ) {
            return "{\"msg\":\"操作成功\",\"code\":200,\"data\":{\"modelName\":\"名称\",\"modelId\":\"xxxx\",\"modelUrl\":\"地址\"},\"success\":true}";
        }
        if (jsonObject == null || jsonObject.size() < 1
        ) {
            return "";
        }
        return JSON.toJSONString(R.success("无数据"));
    }

}
